package com.lzz.bottomencapsulation.app;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;

import com.lzz.bottomencapsulation.utils.LUtils;

public class BaseActivity extends FragmentActivity {
    private static final String TAG = "BaseActivity";
    protected BaseApplication baseApplication;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        baseApplication = BaseApplication.getBaseApplication();
        baseApplication.getAppManager().addActivity(this);//将activity加入记录
    }


    @Override
    protected void onRestart() {
        super.onRestart();
        LUtils.v(TAG, "onRestart");
    }

    @Override
    protected void onStart() {
        super.onStart();
        LUtils.v(TAG, "onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        LUtils.v(TAG, "onResume");
    }

    @Override
    protected void onPause() {
        super.onPause();
        LUtils.v(TAG, "onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        LUtils.v(TAG, "onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        LUtils.v(TAG, "onDestroy");
        baseApplication.getAppManager().finishActivity(this);//删除activity记录
    }


    /**
     * 退出app
     */
    public void exitApp() {
        baseApplication.getAppManager().AppExit(this);
    }
    
}
